<?php
declare (strict_types=1);

namespace app\listener;

use app\common\model\ConsultingQuestion;

class QuestionRead
{
    /**
     * 热门咨询详情读取 事件监听处理
     *
     * @return mixed
     */
    public function handle($params)
    {
        $questionId = $params['questionId'] ?? null;

        if (!is_id($questionId)) {
            return;
        }

        ConsultingQuestion::where('id', $questionId)
            ->inc('readNum', 1)
            ->update();
    }
}
